#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "uthash.h"

/**
 * Definition for a binary tree node.
 */
struct TreeNode {
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
};
typedef struct TreeNode treeNode, *treeNodePtr;

int diameterOfBinaryTree(struct TreeNode* root);
int dfs(treeNodePtr root);
int res;

int main()
{
	return 0;
}

int diameterOfBinaryTree(struct TreeNode* root){
	res = 0;
	dfs(root);
	return res;
}

int dfs(treeNodePtr root) {
	if (!root) return 0;

	int left = dfs(root->left),
		right = dfs(root->right);

	res = fmax(res, left + right);

	return fmax(left, right) + 1;
}
